# top-level CMakeLists.txt

CMAKE_MINIMUM_REQUIRED (VERSION 2.4.0)

project (otfdd)

include (version.cmake)

message (STATUS "*** Building otfdd ${otfdd_VERSION} ***")

include (mysql.cmake)

#options handling
option (ENABLE_DEBUG "enable debug")

IF (ENABLE_DEBUG)
	MESSAGE (STATUS "DEBUG MODE ENABLED")
	SET (CMAKE_BUILD_TYPE "Debug")
	SET (ENABLED_DEBUG "#define DEBUG 1")
ELSE (ENABLE_DEBUG)
	SET (CMAKE_BUILD_TYPE "Release")
	SET (ENABLED_DEBUG "#define NODEBUG")
ENDIF (ENABLE_DEBUG)

IF (NOT WITH_WORKING_DIR)
	SET (WITH_WORKING_DIR "/tmp" CACHE STRING "working directory")
ENDIF (NOT WITH_WORKING_DIR)

IF (NOT WITH_LOG_DIR)
	SET (WITH_LOG_DIR "/var/log" CACHE STRING "log file location")
ENDIF (NOT WITH_LOG_DIR)

IF (NOT WITH_CONF_DIR)
	SET (WITH_CONF_DIR "/etc" CACHE STRING "conf file location")
ENDIF (NOT WITH_CONF_DIR)

IF (NOT WITH_LOCK_DIR)
	SET (WITH_LOCK_DIR "/var/run" CACHE STRING "conf file location")
ENDIF (NOT WITH_LOCK_DIR)

configure_file (${otfdd_SOURCE_DIR}/src/config.h.cmake ${otfdd_BINARY_DIR}/src/config.h)

#inlude all needed source directories
add_subdirectory (src)
